package com.example.demo.config;

import com.example.demo.servlet.SecondServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Servlet;

/**
 * @ClassName ServletConfig
 * @Description ServletConfig   可以直接写入启动类中，包含Configuration注解
 * @Author ZX
 * @Date 2020/5/26 0:06
 */
@Configuration
public class ServletConfig {
    /**
     * @Description:配置SecondServlet
     * @Param:
     * @return:
     */
    @Bean //Bean标签
    public ServletRegistrationBean getServletRegistrationBean(){
        ServletRegistrationBean bean = new ServletRegistrationBean(new SecondServlet());
        bean.addUrlMappings("/second");
        return bean;

    }
}
